package com.cjm.one.model.order.dto;

import com.cjm.one.model.order.enums.PayTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.*;
import lombok.Data;

import java.util.List;
@Data
public class OrderOperateDTO implements java.io.Serializable {
    static final long serialVersionUID = 1L;

    @NotNull(message = "客户ID不能为空")
    @Positive(message = "客户ID必须为正整数")
    private Long customId;

    @NotBlank(message = "用户昵称不能为空")
    @Size(max = 50, message = "昵称长度不能超过50个字符")
    private String nickName;

    // 地址组合字段
    @NotBlank(message = "省份不能为空")
    @Size(max = 20, message = "省份长度异常")
    private String receiverProvince;

    @NotBlank(message = "城市不能为空")
    @Size(max = 20, message = "城市长度异常")
    private String receiverCity;

    @NotBlank(message = "区县不能为空")
    @Size(max = 20, message = "区县长度异常")
    private String receiverDistrict;

    @NotBlank(message = "详细地址不能为空")
    @Size(max = 200, message = "地址长度不能超过200个字符")
    private String receiverAddress;

    @NotBlank(message = "收件人不能为空")
    @Size(max = 30, message = "收件人姓名过长")
    private String receiverName;

    @Pattern(regexp = "^1[3-9]\\d{9}$", message = "手机号格式不正确")
    private String receiverPhone;

    @Size(max = 20, message = "地址标签长度异常")
    private String receiverTagName;

    @Size(max = 500, message = "备注信息过长")
    private String remark;

    @NotNull(message = "支付方式不能为空")
    private PayTypeEnum payType;


    @Valid
    @NotEmpty(message = "订单项不能为空")
    private List<OrderItemDTO> orderList;

    @Schema(description = "请求ID")
    @NotBlank(message = "请求ID不能为空")
    @Size(max = 150, message = "请求ID长度不能超过15个字符")
    private String requestId;
}